#include <iostream>
#include "euler.h"

BEGIN_PROBLEM(100, solve_problem_100)
	PROBLEM_TITLE("Exactly 50% chance of taking two blue discs")
	PROBLEM_ANSWER("756872327473")
	PROBLEM_DIFFICULTY(2)
	PROBLEM_FUN_LEVEL(1)
	PROBLEM_TIME_COMPLEXITY("log(N)")
	PROBLEM_SPACE_COMPLEXITY("1")
END_PROBLEM()

static void solve_problem_100()
{
	const long long N = 1000000000000LL;
	long long x = 1, y = 1;
	while (true)
	{
		long long xx = 3*x + 4*y;
		long long yy = 2*x + 3*y;
		long long n = (1+xx)/2;
		long long b = (1+yy)/2;
		if (n > N)
		{
			std::cout << b << std::endl;
			break;
		}
		x = xx;
		y = yy;
	}
}
